// Problem: Strange town
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/CF42D
// Memory Limit: 250 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <iostream>
#include <cstdio>
using namespace std;
const int S=25,BS=1005;
int n,m,val[S],vis[BS];
inline bool check(int x)
{
val[x]=m;
for(int i=0;i<=BS-3;i++) vis[i]=false;
for(int i=1;i<=x;i++)
{
for(int j=1;j<i;j++)
{
if(vis[val[i]+val[j]]) return false;
vis[val[i]+val[j]]=true;
}
}
return true;
}
int main()
{
scanf("%d",&n);
val[1]=0,val[2]=1;
m=2;
for(int i=3;i<=n;i++)
{
while(!check(i)) m++;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
printf("%d ",i==j?0:val[i]+val[j]);
}
printf("\n");
}
return 0;
}
1422A - Fence | 21D - Traveling Graph |
1559B - Mocha and Red and Blue | 1579C - Ticks |
268B - Buttons | 898A - Rounding |
1372B - Omkar and Last Class of Math | 1025D - Recovering BST |
439A - Devu the Singer and Churu the Joker | 1323A - Even Subset Sum Problem |
1095A - Repeating Cipher | 630F - Selection of Personnel |
630K - Indivisibility | 20B - Equation |
600B - Queries about less or equal elements | 1015A - Points in Segments |
1593B - Make it Divisible by 25 | 680C - Bear and Prime 100 |
1300A - Non-zero | 1475E - Advertising Agency |
1345B - Card Constructions | 1077B - Disturbed People |
653A - Bear and Three Balls | 794A - Bank Robbery |
157A - Game Outcome | 3B - Lorry |
1392A - Omkar and Password | 489A - SwapSort |
932A - Palindromic Supersequence | 433A - Kitahara Haruki's Gift |